<template>
<div class="fix-page">
        <div id="login" class="place">
        <headerNav :isShowBack="true" title="验证码"></headerNav>
        <div class="a"><a href=""></a></div>
        <div class="title">
            <h1>请输入6位验证码</h1>
            <p class="p1">验证码已发送至+8613xxxxxxxxx</p >
        </div>
        <div class="phone-num">
            <p class="phone">6位验证码</p><br>
            <input v-model="code" class="num" type="text" maxlength="6"  ><br>
            <input @click="goLogin" class="yzm" type="button" value="登录" ><br>
            
        </div>
        
    </div>
</div>
</template>

<script>
    import {loginUser} from 'network/index'
    import headerNav from 'components/HeaderNav/headerNav'
    export default {
        name: "input_scode",
        components:{
            headerNav
        },
        data(){
            return{
                code:""
            }
        },
        methods:{
            goLogin(){
                if(this.code.length!==6){
                    this.$toast({
                        message: '请输入正确的验证码信息',
                        type:"fail"
                    });
                    return
                }
                loginUser({
                    username:"test1",
                    password:"test"
                }).then(res=>{
                    if(res.data){
                        this.$store.dispatch("setInfo",res.data)
                    }
                    this.$router.push("/mine")
                    this.$toast({
                        message: '登录成功',
                    });
                }).catch(err=>{
                    this.$toast({
                        message: '登录失败，服务端错误',
                        type:"fail"
                    });
                })
            }
        }
    }
</script>

<style scoped>
 .fix-page{
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        right: 0;
        background: #fff;
        z-index: 777;
    }
    .fix-page .place{
        overflow: auto;
        height: 100%;
    }
    .text2{
      text-align: center;
      margin-top: 80px;
    }
   #login{
       padding: 0 20px 80px;
   }
  .num{
      background:transparent;
      border:none;
      border-bottom: 1px solid #ccc;
      height: 30px;
      width: 100%;
  }
  .yzm{
      height: 50px;
      width: 100%;
      text-align: center;
      background-color: rgb(0, 138, 133);
      border-radius:8px;
      border: none;
      color:rgb(255, 255, 255);
      margin-top: 60px;
  }
  .foot{
      font-size: 13px;
      margin-right: 20px;
      text-align: center;
      margin-top: 30px;
      bottom: 55px;
  }
  .phone{
      margin-top: 80px;
  }
  .left{
      margin-top: 16px;
      color: rgb(0, 138, 133);
  }
  .right{
      margin-top: 16px;
      color: rgb(127, 127, 127);
  }
  .p1{
      margin-top: 10px;
      color: rgb(127, 127, 127);
  }
</style>